<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="/fuman/js/purchase.js?{{$randmon}}" ></script>

<title>添加采购单</title>
<style>
.p_del{height:14px; width:14px;background:url(/fuman/images/no.gif) no-repeat;text-decoration:none;}
.p_img{width:100px;}
#search_rs{width:800px;position:absolute;background:#fff;border:1px solid gray;}
#search_rs .thead td{background:gray;color:#fff;}
#search_rs td{background:#f1f1f1;}
#search_rs img{height:30px;}
.price{width:60px;height:22px;border:1px solid #A6A6A6;line-height:22px;padding:0 0 0 2px;font-size:14px;line-height:20px;}
.num{width:60px;height:22px;border:1px solid #A6A6A6;line-height:22px;padding:0 0 0 2px;font-size:14px;line-height:20px;}
.total{width:60px;height:22px;border:1px solid #A6A6A6;line-height:22px;padding:0 0 0 2px;font-size:14px;line-height:20px;}
</style>
<script language="javascript">
	function delli(o)
	{
		$(o.parentNode.parentNode).remove();
	}
   function selectType() {
      var made_factory = $("#made_factory").val();
       if(made_factory==3){
         $("#madeway").show();
       }else{
         $("#madeway").hide();
       }
   }

</script>
<body class="withvernav">
<div class="bodywrapper"> {{include file='/public/leftmenu.tpl'}}
  <div class="centercontent">
    <div class="pageheader notab">
      <h1 class="pagetitle">添加采购单</h1>
      <span class="pagedesc"> <span style="color:red;font-size:16px;font-weight: 600;">1、外采购商品更改采购价会自动更新商品的成本价</span><br/></span>
      <span class="pagedesc"> <span style="color:red;font-size:16px;font-weight: 600;">2、采购单中有相同的SKU系统自动合并,定制商品无尺码信息请分开填写采购单</span><br/></span>
       <span class="pagedesc"> <span style="color:red;font-size:16px;font-weight: 600;">3、采购途径为1688，填写采购编号之后，系统会自动抓取运单号</span><br/></span>
       <span class="pagedesc"> <span style="color:blue;font-size:16px;font-weight: 600;">4、每个SKU都会自动生成一串唯一识别码，让淘宝商家将唯一识别码贴在物品包装上，<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;可以省略填写运单号【针对网站衣服定制、鞋子定制等】</span><br/></span>
      <div class="menulist">
        <ul class="profile_summary">
         
        </ul>
      </div>
    </div>
    <!--pageheader-->
    
    <div id="contentwrapper" class="contentwrapper">
      <div id="basicform" class="subcontent">
        <form class="stdform stdform2"  id="goodsForm" method="post" action="/purchase/savepurchase">
        <input type="hidden" name="pid" value="{{$detail.id}}">
          <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
            <thead>
              <tr>
                <th colspan="2" class="head1">采购单信息</th>
              </tr>
            </thead>
          </table>
          <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
            <tbody>
             
               <tr>
                <td class="head1" width="120" bgcolor="#FFFFFF">搜索商品信息</td>
                <td bgcolor="#FFFFFF">
                <div style="float:left; padding-right:10px;">
                <input type="text" id="psearch_key" name="psearch_key"  style="width:400px" class="width400" value="" placeholder="SKU,商品中文"></div><div style="padding-left:50px;"><img src="/fuman/images/search1.png" style="cursor:pointer" id="p_search"></div></td>
                <td width="45%" bgcolor="#FFFFFF"><a href="/purchase/automaticProducePurchase" target="_blank" style="color:#3550A3;text-decoration:underline;">从库存预警添加商品</a></td>
              </tr>
             </tbody>
           </table>
           <br>
            <input type="hidden" id="hidden_data" value="" />
        
          <table cellpadding="0" cellspacing="0" border="0" class="stdtable" style="table-layout: fixed;" id="purchase_list">
          <thead>

            <tr>
            <td height="35" width="3%"  bgcolor="#FEFFF1"><b><a href="javascript:;" onClick="SelectAlls()" style="color:#013299; text-decoration:underline;">全选</a></b></td>
              <td height="35" width="5%"  bgcolor="#FEFFF1"><b>商品图片</b></td>
              <td  bgcolor="#FEFFF1"><b>商品名称</b></td>
              <td width="15%" bgcolor="#FEFFF1"><b>商品编号</b></td>
              <td width="7%" bgcolor="#FEFFF1"><strong>采购点</strong></td>
              <td width="9%" bgcolor="#FEFFF1"><strong>本次采购价</strong></td>
              <td width="6%" bgcolor="#FEFFF1"><b>数量</b></td>
              <td width="7%" bgcolor="#FEFFF1"><strong>合计金额</strong></td>
              <td width="10%" bgcolor="#FEFFF1"><strong>当前库存</strong></td>
               <td width="7%" bgcolor="#FEFFF1"><strong>标识</strong></td>
                <td width="10%" bgcolor="#FEFFF1"><strong>备注</strong></td>
            </tr>
            </thead>
             {{foreach from=$detail_list item=li key=key}}
            <tr>
              <td width="3%" bgcolor="#FFFFFF"><img src=/fuman/images/no.gif onClick="delli(this)"  style="cursor:pointer" >
              {{if $detail.zt==21}}
                <input name="ppid[]" type="checkbox" class="none" id="ppid[]" value="{{$li.id}}" />
              {{/if}}
              </td>
              <td width="32%" bgcolor="#FFFFFF"><div class="lbt"><a href="/product/editProduct?goods_id={{$li.goods_id}}" target="_blank"><img src={{$li.imagesurl}} width="60" height="60"></a></div>
                  <div class="lbcp"><input  type="hidden"  readonly="true" size="20" name=good_namec[] value="{{$li.good_name}}" /><br />
                      </div></td>
              <td bgcolor="#FFFFFF">{{$li.good_name}}<br>
                {{if $li.dailysales}} <br>日均销量 {{$li.dailysales}}<br>
              7/30/60销量: {{$li.sales1}}/{{$li.sales2}}/{{$li.sales3}}<br> {{/if}}
              </td>
              <td bgcolor="#FFFFFF"><a href="/product/productlist?other={{$li.good_no}}" target="_blank">{{$li.good_no}}</a><input readonly name="good_no[]" size="10" type="hidden"  value="{{$li.good_no}}" /><input type="hidden" name="goods_id[]" value="{{$li.goods_id}}"></td>
              <td bgcolor="#FFFFFF">
              <input type="hidden" size="3"  name="buyer[]" value="{{$li.buyer}}" />
              <a href="{{$li.businessmanline}}" target=thank><span style="color:#444">{{$li.buyer}}</span></a></td>
              <td bgcolor="#FFFFFF"><input name="price[]" class="price" size="10" value="{{$li.price}}"/>{{$li.price}}</td>
              <td bgcolor="#FFFFFF"><input type="number" size="3" name=nums[] id="skusum" class="num" onKeyUp="this.value=this.value.replace(/[^0-9]/g,'');" value="{{$li.nums}}"  /></td>
              <td bgcolor="#FFFFFF"><input name="total[]" class="total" size="10" value="{{$li.total}}" readonly /></td>
              <td bgcolor="#FFFFFF">
              {{foreach from=$li.storage item=lis key=key}}
              	{{$lis.stock}} {{$lis.storage_name}}  {{$lis.positions}} <br>
              {{/foreach}}

             </td>
               <td bgcolor="#FFFFFF">
               {{$li.skucode}}
                <input  type="hidden"  readonly="true"  name=skucode[] value="{{$li.skucode}}" />
             </td>
              <td bgcolor="#FFFFFF">
              	 <input type="text" class="width200"  name="skumemo[]" value="{{$li.skumemo}}"  placeholder="交易单号或其他信息"/>
             </td>
            </tr>
           {{/foreach}}
          </table>
          
          <br>
          <table cellpadding="0" cellspacing="0" border="0" class="stdtable" >
            <thead>
              <tr>
                <th colspan="8" class="head1">采购单信息</th>
              </tr>
            </thead>
            <tr>
              <td width="8%" height="40" align="right">发往仓库：</td>
              <td width="7%">
              <select name="tostock" size="1" class="full_input">
              {{foreach from = $storagelist key=key item=li}}
                <option value="{{$li.id}}" {{if $detail.cang == $li.id}} selected{{/if}}>{{$li.storagename}}</option>
              {{/foreach}}
              </select></td>
              <td width="7%" align="right">预计入库时间：</td>
              <td width="12%"><span class="kcceng2b">
                <input name="daysum" id="daysum" size="10" class="width200" value="{{if $detail.daysum}}{{$detail.daysum}}{{else}}5{{/if}}" />
              &nbsp;&nbsp;天<span style="color:#cccccc">&nbsp;数字</span> </span></td>
            </tr>
            <tr>
              <td height="40" align="right">商品费用：</td>
              <td><span class="kcceng2b">
                <INPUT name="goodsprice" id="goodsprice" class="bd5" style="width:80px;"  value="{{$detail.goodsprice}}" onBlur="totalall()" readonly/>
              </span></td>
              <td align="right">运费：</td>
              <td><span class="kcceng2b">
                <INPUT name="takeprice" id="takeprice" class="bd5" value="{{$detail.takeprice}}" onBlur="totalall()" />
              </span></td>
            </tr><tr>
              <td align="right" height="40">其他费用：</td>
              <td width="13%"><span class="kcceng2b">
                <input name="othermoney" id="othermoney" class="bd5" value="{{$detail.othermoney}}" onBlur="totalall(0)" />
              </span></td>
              <td align="right" height="40">费用合计：</td>
              <td><span class="kcceng2b">
                <input name="allmoney" id="allmoney" class="bd5" value="{{$detail.allmoney}}" readonly/>
              </span></td>
            </tr>
            <tr>
              <td align="right">供应商：</td>
              <td height="40" colspan="1" align="left">
                <select name="made_factory" id="made_factory" size="1" class="full_input" onChange="selectType();">
               <option value="">请选择</option>
              {{foreach from = $factorylist key=key item=li}}
                <option value="{{$li.id}}" {{if $detail.made_factory == $li.id}} selected{{/if}}>{{$li.name}}</option>
              {{/foreach}}
              </select>
                <span style="display:{{if $detail.made_factory ==3}}{{else}}none{{/if}};" id="madeway">
                    &nbsp;外采购途径：
                    <select name="made_way" id="made_way" size="1" class="full_input">
                      <option value="">请选择</option>
                      <option value="1" {{if $detail.made_way ==1}}selected{{/if}}>淘宝网</option>
                      <option value="2" {{if $detail.made_way ==2 || $detail.made_way ==3}}selected{{/if}}>1688</option>
                      <option value="99" {{if $detail.made_way ==99}}selected{{/if}}>其他</option>
                    </select>
                </span>
                <br/>
                <span style="color:red;font-size:16px;">
               备注：供应商不同，采购流程也不同。请慎重选择！
                  </span>
              </td>
              <td height="40" align="right">总数量：</td>
              <td height="40" align="left">{{$totalnums}}</td>
            </tr>
            <tr>
              <td align="right">采购编号</td>
              <td height="40"  align="left">
              <input name="platform_message" id="platform_message"  class="width400" value="{{$detail.tb_ordersn}}" />
            </td>
             <td align="right">订单号</td>
              <td height="40"  align="left">
              <input name="ordersn" id="ordersn"  class="width400" value="{{$detail.ordersn}}" />
            </td>
            </tr>
            <tr>
            <td align="right">添加备注：</td>
              <td height="40" colspan="3" align="left"> <span style="padding-left:40px;">
              <!--<input type="button" onClick="addmemo()" value="添加">--><br>
        {{foreach from=$memo item=li key=key}}
        {{$key+1}}:{{$li.itime}}&nbsp;[{{$li.username}}]&nbsp;{{$li.memo}}
        <br>
        {{/foreach}}
      
        <textarea name="memo" rows="5" cols="10" class="full_input">{{$detail.memo}}</textarea>
         
      
              </span></td>
            </tr>
            <tr>
                <td bgcolor="#FFFFFF" colspan="8"><input type="hidden" name="typeid" id="typeid">     <button type="button" onClick="submitup(1)" class="btn btn-primary" > 确定保存 </button>                 </td>
              </tr>
          </table>
       
        </form>
        <!-- 日志信息-->
        {{if $loglist}}
        <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
          <thead>
          <tr>
            <th colspan="2" class="head1">质检入库日志信息</th>
          </tr>
          </thead>
        </table>
        <input type="hidden" id="hidden_data" value="" />

        <table cellpadding="0" cellspacing="0" border="0" class="stdtable" style="table-layout: fixed;" id="purchase_list">
          <thead>
          <tr>
            <td bgcolor="#FEFFF1"><b>序号</b></td>
            <td  bgcolor="#FEFFF1"><strong>商品名称</strong></td>
            <td bgcolor="#FEFFF1"><strong>商品编号</strong></td>
            <td bgcolor="#FEFFF1"><strong>商品子SKU</strong></td>
            <td bgcolor="#FEFFF1"><strong>入库数量</strong></td>
            <td bgcolor="#FEFFF1"><strong>备注</strong></td>
            <td bgcolor="#FEFFF1"><strong>质检者</strong></td>
            <td bgcolor="#FEFFF1"><strong>质检时间</strong></td>
            <td bgcolor="#FEFFF1"><strong>所在仓位</strong></td>
          </tr>
          </thead>
          {{foreach from=$loglist item=li key=key}}
          <tr>
            <td width="32%" bgcolor="#FFFFFF">{{$li.id}}</td>
            <td bgcolor="#FFFFFF">{{$li.good_name}}</td>
            <td bgcolor="#FFFFFF">{{$li.good_parent_sku}}</td>
            <td bgcolor="#FFFFFF">{{$li.good_no}}</td>
            <td bgcolor="#FFFFFF">{{$li.inStockNum}}</td>
            <td bgcolor="#FFFFFF">{{$li.memo}}</td>
            <td bgcolor="#FFFFFF">{{$li.username}}</td>
            <td bgcolor="#FFFFFF">{{$li.createtime}}</td>
            <td bgcolor="#FFFFFF">
              {{if $li.cang eq 1}}
              一号仓
              {{elseif $li.cang eq 2}}
              二号仓
              {{else}}
              {{/if}}
            </td>
          </tr>
          {{/foreach}}
        </table>
        {{/if}}

        <!-- 日志信息-->
        {{if $statusloglist}}
        <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
          <thead>
          <tr>
            <th colspan="2" class="head1">状态变更日志信息</th>
          </tr>
          </thead>
        </table>
        <input type="hidden" id="hidden_data" value="" />

        <table cellpadding="0" cellspacing="0" border="0" class="stdtable" style="table-layout: fixed;" id="purchase_list">
          <thead>
          <tr>
            <td bgcolor="#FEFFF1"><b>序号</b></td>
            <td  bgcolor="#FEFFF1"><strong>订单编号</strong></td>
            <td bgcolor="#FEFFF1"><strong>内容</strong></td>
            <td bgcolor="#FEFFF1"><strong>操作者</strong></td>
            <td bgcolor="#FEFFF1"><strong>操作时间</strong></td>
          </tr>
          </thead>
          {{foreach from=$statusloglist item=li key=key}}
          <tr>
            <td width="32%" bgcolor="#FFFFFF">{{$li.id}}</td>
            <td bgcolor="#FFFFFF">{{$li.goods_code}}</td>
            <td bgcolor="#FFFFFF">{{$li.details}}</td>
            <td bgcolor="#FFFFFF">{{$li.username}}</td>
            <td bgcolor="#FFFFFF">{{$li.createtime}}</td>
          </tr>
          {{/foreach}}
        </table>
        {{/if}}
       
      
    </div>
    <!--contentwrapper--> 
    
  </div>
  <!-- centercontent --> 
  
</div>
<!--bodywrapper-->

</body>
</html>